var member_id = store_id = ws = cart_id = '';
document.addEventListener('plusready',function(){
	member_id = plus.storage.getItem('id');
	store_id = plus.storage.getItem('store_id');
	ws = plus.webview.currentWebview();
	cart_id = ws.cart_id;
//	console.log(apiRoot+"?act=goods&op=goods_list_zcx&gc_id="+cart_id+'&store_id='+store_id);
	$.ajax({    
		type:"gat", 
		url:apiRoot+"?act=goods&op=goods_list_zcx&gc_id="+cart_id+'&store_id='+store_id,
		dataType:'json', 
		success:function(data){ 
			console.log(JSON.stringify(data));
			if(data.code == 200){ 
				var html = '';   
				$.each(data.datas, function(k,v) {
					html += '<ul class="mui-table-view Driving" data-id="'+ v.goods_id +'" data-did="'+ v.store_id +'">'+
								'<li class="mui-table-view-cell mui-media">'+
									'<a href="javascript:;">'+
										'<img class="mui-media-object mui-pull-left" src="'+ pics + v.store_id + '/' + v.goods_image +'">'+
										'<div class="mui-media-body">'+
											'<b>'+ v.goods_name +'</b>'+
											'<p>'+v.goods_custom["驾校场地"]+'</p>'+
											'<p class="mui-h6">'+ v.goods_custom["驾校地址"]+'</p>'+
										'</div>'+
									'</a>'+
								'</li>'+
							'</ul>';
				}); 
				$('.School').html(html);
			} 
			//详情
			$('.Driving').unbind('click');
			$('.Driving').on('click',function(){
				var _this = $(this); 
				var goodsid = _this.attr('data-id');
				var store_id = _this.attr('data-did');
				var nwaiting = plus.nativeUI.showWaiting();//显示原生等待框
				var webviewContent= plus.webview.create('./Driving_details.html','Driving_details.html',{},{goodsid:goodsid,store_id:store_id});//后台创建webview并打开show.html
				webviewContent.addEventListener("loaded", function() { //注册新webview的载入完成事件
			        nwaiting.close(); //新webview的载入完毕后关闭等待框
			        webviewContent.show("slide-in-right",500); //把新webview窗体显示出来，显示动画效果为速度200毫秒的右侧移入动画
			    }, false);
			})
		}, 
		error:function(e){
			toast('连接失败！');
		}
	});
},false);